home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 10
/
FM Towns Free Software Collection 10.iso
/
ms_dos
/
tool
/
fapxtool
/
src
/
txm
/
txmetc.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-11-18
|
2KB
|
94 lines
/***************
*
* e:\usr\exe\txm\txmetc.c
*/
#include "txm.h"
int matchstr(char *form, char *txtptr)
{
char *logtmp;
char *strtmp;
int i, trueflg = 0, count = 0;
logtmp = txtptr;
strtmp = form;
while (*strtmp != NUL) {
trueflg = FALSE;
switch (*strtmp) {
case '%':
if (isdigit(*logtmp) || (*logtmp == ' ')) {
trueflg = TRUE;
}
break;
case '*':
if (isalpha(*logtmp)) {
trueflg = TRUE;
}
break;
case '&':
if (isalpha(*logtmp) || isdigit(*logtmp)) {
trueflg = TRUE;
}
break;
case '_':
if (*logtmp == ' ') {
trueflg = TRUE;
}
break;
case '$':
trueflg = TRUE;
break;
case 0x27:
strtmp++;
if (*logtmp == *strtmp) {
trueflg = TRUE;
}
break;
case '^':
strtmp++;
count = ((*strtmp) - ('0'));
strtmp++;
while (trueflg != TRUE) {
for (i = 0; i < count; i++) {
if ((*(logtmp + i) != *(strtmp + i)) || (*(logtmp + i)
== 0x0d)) {
break;
}
}
if (i != count) {
logtmp++;
if (*logtmp == 0x0a) {
break;
}
}
else {
trueflg = TRUE;
}
}
break;
default:
if (islower(*strtmp)) {
if (tolower(*logtmp) == *strtmp) {
trueflg = TRUE;
}
}
else {
if (*logtmp == *strtmp) {
trueflg = TRUE;
}
}
}
/* fprintf(stdout, "matchstr:%c,%c:", *strtmp, *logtmp); */
if (trueflg != TRUE) {
/* puts("NG!"); */
return (FALSE);
}
/* puts("GOOD!"); */
strtmp++;
logtmp++;
}
return (TRUE);
}